﻿@using PerpetuumSoft.Knockout

@model ContractorTimesheet.Models.MonthlyReportModel

@{var ko = Html.CreateKnockoutContext(); }

<h2>Monthly Report</h2>

@*@Html.ActionLink("Copy", "")
<button id="btnCopy">copy</button>*@
<br />
<br />

<div align="center" id="divReport">

    <table id="tableReport" border="1" cellpadding="200" cellspacing="100" width="80%">
        <tbody>
            <tr>
                <td height="5" colspan="5"></td>
            </tr>
            <tr>
                <td colspan="5">
                    <table width="100%">
                        <tr>
                            <td>
                                &nbsp;Month: @ko.Html.Span(m => m.Month)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;Number of Working Days: @ko.Html.Span(m => m.NoOfWorkingDays)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;Number of Public Holidays: @ko.Html.Span(m => m.NoOfPublicHolidays)
                                (@ko.Html.Span(m => m.PublicHolidays))
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;Number of Actual Working Days: @ko.Html.Span(m => m.NoOfActualWorkingDays)
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td height="5" colspan="5"></td>
            </tr>
            <tr>
                <td align="center" width="10%">
                    Badge Number
                </td>
                <td align="center" width="10%">
                    Resource Name
                </td>
                <td align="center" width="5%">
                    REQ/PO
                </td>
                <td width="15%" align="center">
                    Leaves Taken/Will be Taken
                </td>
                <td width="10%" align="center">
                    Actual Days Worked
                </td>
            </tr>
            @using (var item = ko.Foreach(m => m.ContractorLeaves))
            {
                <tr>
                    <td align="center">
                        @item.Html.Span(m => m.BadgeNo)
                    </td>
                    <td>
                        &nbsp;
                        @item.Html.Span(m => m.ResourceName)
                    </td>
                    <td align="center">
                        @item.Html.Span(m => m.PO)
                    </td>
                    <td align="left">
                        &nbsp;@item.Html.Span(m => m.NoOfLeavesTaken)
                        @item.Html.Span(m => m.LeavesTaken)
                    </td>
                    <td align="center">
                        @item.Html.Span(m => m.DaysWorked)
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

<script type="text/javascript" language="javascript">
    
    $(document).ready(function () {

        //alert($('#divReport').html());

        // The link with ID "copy-description" will copy the text of the paragraph with ID "description"

        $('#btnCopy').zclip({
            path: 'scripts/ZeroClipboard.swf',
            copy: $('#divReport').text
        });


        // The link with ID "copy-dynamic" will copy the current value of a dynamically changing input with the ID "dynamic"

        //$('#btnCopy').zclip({
        //    path: 'js/ZeroClipboard.swf',
        //    copy: function () { return $('divReport').val(); }
        //});

    });

</script>


@ko.Apply(Model)
